#ifndef COUNCILMEMBERMANAGER_H
#define COUNCILMEMBERMANAGER_H

#include <map>

#include "ISerializable.h"
#include "IStringRepresentable.h"
#include "CouncilMember.h"

class CouncilMemberManager : public ISerializable, public IStringRepresentable
{
public:
  typedef std::map<std::string, CouncilMember> CouncilMemberMap;
  typedef std::pair<std::string, CouncilMember> CouncilMemberPair;

  CouncilMemberManager()
  {    
  }

  virtual ~CouncilMemberManager()
  {
  }

  const CouncilMemberMap& members() const { return m_members; }
  const CouncilMember *memberById(const std::string &id) const;
  virtual bool serialize(const std::string& fileName) const;
  virtual bool deserialize(const std::string& fileName);
  void clear() { m_members.clear(); }
  virtual std::string toString() const;

  void insert(const CouncilMember& member)
  {
    m_members[member.id()] = member;
  }

  int size() const { return static_cast<int>(m_members.size()); }

private:
  void toStream(std::ostream& stream) const;

  CouncilMemberMap m_members;
};

#endif // COUNCILMEMBERMANAGER_H